package com.stormrage.entity.shiro;

import java.io.Serializable;

import com.stormrage.entity.ent.EntAcct;

/**
 * @author www.stormragetech.com
 * @date 2016年3月30日
 * @version 1.0.0
 */
public class ShiroAcct implements Serializable {

	// ------------------------------- Fields -------------------------------

	private static final long serialVersionUID = 1322688205872381361L;

	// ------------------------------- Fields -------------------------------

	private String id;

	private String acct;

	private String pass;

	private String salt;

	private String name;

	private Integer locked;

	// ------------------------------- Fields -------------------------------

	public ShiroAcct() {
	}

	// ------------------------------- Fields -------------------------------

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getAcct() {
		return acct;
	}

	public void setAcct(String acct) {
		this.acct = acct;
	}

	public String getPass() {
		return pass;
	}

	public void setPass(String pass) {
		this.pass = pass;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getLocked() {
		return locked;
	}

	public void setLocked(Integer locked) {
		this.locked = locked;
	}

	// ------------------------------- Fields -------------------------------

	public String getSign() {
		return acct + salt;
	}

	public static ShiroAcct instance(EntAcct arg0) {
		ShiroAcct entity = new ShiroAcct();
		entity.setId(String.valueOf(arg0.getId()));
		entity.setAcct(arg0.getAcct());
		entity.setPass(arg0.getPass());
		entity.setSalt(arg0.getSalt());
		entity.setName(arg0.getRealName());
		entity.setLocked(arg0.getLocked());
		return entity;
	}

	@Override
	public String toString() {
		return this.getClass() + " : id - " + id + " acct - " + acct + " pass - " + pass + " salt - " + salt
				+ " locked - " + locked;
	}

}
